package org.dyk.mallmanagementsystem.service.admin;

import org.dyk.mallmanagementsystem.model.Admin;
import org.dyk.mallmanagementsystem.repository.AdminRepository;
import org.dyk.mallmanagementsystem.service.admin.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminRepository adminRepository;

    @Override
    public Admin login(String adminLoginName, String adminPasswor) {
        Admin admin = null;
        try {
            admin = adminRepository.findByAdminLoginName(adminLoginName);
        }catch (Exception e){
            e.printStackTrace();
        }
        if (null != admin && adminPasswor.equals(admin.getAdminPassword())){
            return admin;
        }
        return null;
    }
}
